package router

import (
	"oa-system/internal/api/handler"
	"oa-system/internal/config"
	"oa-system/internal/database"
	"oa-system/internal/repository"
	"oa-system/internal/service"

	"github.com/gin-gonic/gin"
)

func RegisterDictRoutes(r *gin.Engine) {
	dictRepository := repository.NewDictionaryRepository(database.DB)
	dictService := service.NewDictionaryService(dictRepository)
	dictHandler := handler.NewDictionaryHandler(dictService)

	api := r.Group(config.GlobalConfig.App.APIPrefix)
	dictGroup := api.Group("/dicts")
	// dictGroup.Use(middleware.JWTAuthMiddleware())
	{
		dictGroup.GET("", dictHandler.GetAllDictionaries)
		dictGroup.POST("", dictHandler.CreateDictionary)
		dictGroup.PUT("/:id", dictHandler.UpdateDictionary)
		dictGroup.DELETE("/:id", dictHandler.DeleteDictionary)
		dictGroup.GET("/all", dictHandler.GetAllDictionaries)
	}
}
